import React, {useRef, useState} from 'react';
import {Input} from "antd";

export default function UseRef() {
    const myRef=useRef()
    const [value,setValue]=useState()
    function getValue(){
        setValue(myRef.current.input.value)
    }
    return (
        <div>
            <h2>使用useRef获取组件</h2>
            <span>value:{value}</span>
            <Input ref={myRef} onBlur={getValue}></Input>
        </div>
    );
};
